package com.first.orange.service.impl;

import com.first.orange.beans.UserLogin;
import com.first.orange.mapper.UserMapper;
import com.first.orange.service.UserService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created on 2021/7/6.
 * <p>
 * Author: wanglinjun
 * <p>
 * Description:
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired(required = false)
    private UserMapper userMapper;

    @Override
    public Boolean queryshowList(String username, String password) {
        if (null == userMapper.selectshowListByuserNameAndpassword(username, password)) {
            return false;
        }
        return true;
    }

    /**
     * @author : Lcywings
     * @date : 2021/7/12 11:39
     * @acl : true
     * @description : 根据用户名去查询用户，查到了即为已经注册
     */
    @Override
    public Boolean userRegister(UserLogin userLogin) {
        if (null == userMapper.selectUserListByUserName(userLogin)) {
            return false;
        }
        return true;
    }

    /**
     * @author : Lcywings
     * @date : 2021/7/12 11:39
     * @acl : true
     * @description : 根据手机号去查询用户，查到了即为已经注册
     */
    @Override
    public Boolean userRegisterByPhone(UserLogin userLogin) {
        if (null == userMapper.userRegisterByPhone(userLogin)) {
            return false;
        }
        return true;
    }

    @Override
    public UserLogin queryUser(String username, String password) {
        return userMapper.selectshowListByuserNameAndpassword(username, password);
    }


    @Override
    public void doRegister(UserLogin userLogin) {
        userMapper.insertUserList(userLogin);
    }


}


